home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / bbs / mfm_111b.zip / DISPLAY.PAS < prev    next >
Pascal/Delphi Source File  |  1992-01-07  |  7KB  |  250 lines

  1. {========================================================================}
  2. Function GetDateString(PackedTime : Longint) : S8;
  3.   Var
  4.     Month, Day : String[2];
  5.     Year : String[4];
  6.   Begin
  7.     UnpackTime(PackedTime,Date);
  8.     Str(Date.Month,Month); Str(Date.Day,Day); Str(Date.Year,Year);
  9.     If Length(Month) = 1 Then Month := '0' + Month;
  10.     If Length(Day) = 1 Then Day := '0' + Day;
  11.     Year := Copy(Year,3,2);
  12.     GetDateString := Month + '/' + Day + '/' + Year;
  13.   End;
  14. {========================================================================}
  15. Function GetTimeString(PackedTime : Longint) : S8;
  16.   Var
  17.     Hour, Min, Sec : String[2];
  18.   Begin
  19.     UnpackTime(PackedTime,Date);
  20.     Str(Date.Hour,Hour); Str(Date.Min,Min); Str(Date.Sec,Sec);
  21.     If Length(Hour) = 1 Then Hour := '0' + Hour;
  22.     If Length(Min) = 1 Then Min := '0' + Min;
  23.     If Length(Sec) = 1 Then Sec := '0' + Sec;
  24.     GetTimeString := Hour + ':' + Min + ':' + Sec;
  25.   End;
  26. {========================================================================}
  27. Function GetPackedTime(DateString, TimeString : S8) : Longint;
  28.   Var
  29.     Code : Word;
  30.     PackedTime : Longint;
  31.   Begin
  32.     Val(Copy(DateString,1,2),Date.Month,Code);
  33.     Val(Copy(DateString,4,2),Date.Day,Code);
  34.     Val('19'+Copy(DateString,7,2),Date.Year,Code);
  35.     Val(Copy(TimeString,1,2),Date.Hour,Code);
  36.     Val(Copy(TimeString,4,2),Date.Min,Code);
  37.     Val(Copy(TimeString,7,2),Date.Sec,Code);
  38.     PackTime(Date,PackedTime);
  39.     GetPackedTime := PackedTime;
  40.   End;
  41. {========================================================================}
  42. Procedure BlankCurrentLocation;
  43.   Begin
  44.     AnsiGotoXY(Row,1);
  45.     If CurrentEntry^.Tagged Then
  46.     Begin
  47.       NewTextColor(White); Write('∙');
  48.     End
  49.     Else
  50.     Begin
  51.       NewTextColor(White); Write(' ');
  52.     End;
  53.     AnsiGotoXY(24,80);
  54.   End;
  55. {========================================================================}
  56. Procedure DisplayCurrentLocation;
  57.   Begin
  58.     AnsiGotoXY(Row,1);
  59.     If CurrentEntry^.Tagged Then
  60.     Begin
  61.       NewTextColor(White+Blink); Write('»'); NewTextColor(White);
  62.     End
  63.     Else
  64.     Begin
  65.       NewTextColor(White+Blink); Write('>'); NewTextColor(White);
  66.     End;
  67.     AnsiGotoXY(24,80);
  68.   End;
  69. {========================================================================}
  70. Procedure DisplayRecord(Row : Byte);
  71.   Begin
  72.     AnsiGotoXY(Row,1); AnsiClearToEOL;
  73.     NewTextColor(White);
  74.     If NextPrintEntry^.Tagged Then Write('∙');
  75.     AnsiGotoXY(Row,2);
  76.     Case NextPrintEntry^.TypeOfRecord Of
  77.       Comment :
  78.       Begin
  79.         NewTextColor(White);
  80.         Write(NextPrintEntry^.Description);
  81.       End;
  82.       FileRecord :
  83.       Begin
  84.         NewTextColor(Yellow);
  85.         Write(Copy(NextPrintEntry^.FileName+'            ',1,12));
  86.         NewTextColor(Magenta);
  87.         Write(NextPrintEntry^.FileSize:8);
  88.         NewTextColor(Green);
  89.         Write(' ' + GetDateString(NextPrintEntry^.FileDate)  + '  ');
  90.         NewTextColor(Cyan);
  91.         Write(Copy(NextPrintEntry^.Description,1,48));
  92.       End;
  93.       Orphan :
  94.       Begin
  95.         NewTextColor(Yellow);
  96.         Write(Copy(NextPrintEntry^.FileName+'            ',1,12));
  97.         NewTextColor(Magenta);
  98.         Write(NextPrintEntry^.FileSize:8);
  99.         NewTextColor(Green);
  100.         Write(' ' + GetDateString(NextPrintEntry^.FileDate)  + '  ');
  101.         NewTextColor(Red);
  102.         Write('Orphan');
  103.       End;
  104.       Offline :
  105.       Begin
  106.         NewTextColor(Yellow);
  107.         Write(Copy(NextPrintEntry^.FileName+'            ',1,12));
  108.         NewTextColor(Red);
  109.         Write(' offline           ');
  110.         NewTextColor(Cyan);
  111.         Write(Copy(NextPrintEntry^.Description,1,48));
  112.       End;
  113.     End;
  114.   End;
  115. {========================================================================}
  116. Procedure DisplayScreen;
  117.   Var
  118.     Dsb : Byte;
  119.   Begin
  120.     NextPrintEntry := TopEntry;
  121.     Dsb := 1;
  122.     While (Dsb < 23) And (NextPrintEntry^.NextEntry <> NIL) Do
  123.     Begin
  124.       DisplayRecord(Dsb);
  125.       NextPrintEntry := NextPrintEntry^.NextEntry; Inc(Dsb);
  126.     End;
  127.     DisplayRecord(Dsb);
  128.     DisplayCurrentLocation;
  129.     If Dsb < 23 Then
  130.     Begin
  131.       Repeat
  132.         Inc(Dsb);
  133.         AnsiGotoXY(Dsb,1); AnsiClearToEOL;
  134.       Until Dsb = 23;
  135.     End;
  136.     AnsiGotoXY(24,80);
  137.   End;
  138. {========================================================================}
  139. Procedure LineUp;
  140.   Begin
  141.     If CurrentEntry^.PrevEntry <> NIL Then
  142.     Begin
  143.       If Row > 1 Then
  144.       Begin
  145.         BlankCurrentLocation;
  146.         Dec(Row); CurrentEntry := CurrentEntry^.PrevEntry;
  147.         DisplayCurrentLocation;
  148.       End
  149.       Else
  150.       Begin
  151.         CurrentEntry := CurrentEntry^.PrevEntry;
  152.         TopEntry := CurrentEntry;
  153.         DisplayScreen;
  154.       End;
  155.     End;
  156.   End;
  157. {========================================================================}
  158. Procedure LineDown;
  159.   Begin
  160.     If CurrentEntry^.NextEntry <> NIL Then
  161.     Begin
  162.       If Row <= 22 Then
  163.       Begin
  164.         BlankCurrentLocation;
  165.         Inc(Row); CurrentEntry := CurrentEntry^.NextEntry;
  166.         DisplayCurrentLocation;
  167.       End
  168.       Else
  169.       Begin
  170.         CurrentEntry := CurrentEntry^.NextEntry;
  171.         TopEntry := TopEntry^.NextEntry;
  172.         DisplayScreen;
  173.       End;
  174.     End;
  175.   End;
  176. {========================================================================}
  177. Procedure PageUp;
  178.   Begin
  179.     If NumberOfEntries <= 23 Then
  180.     Begin
  181.       CurrentEntry := FirstEntry; Row := 1;
  182.       DisplayScreen;
  183.     End
  184.     Else
  185.     Begin
  186.       Counter := 1;
  187.       While (Counter < 23) And (TopEntry^.PrevEntry <> NIL) Do
  188.       Begin
  189.         Inc(Counter); TopEntry := TopEntry^.PrevEntry;
  190.       End;
  191.       While (Counter > 1) And (CurrentEntry^.PrevEntry <> NIL) Do
  192.       Begin
  193.         Dec(Counter); CurrentEntry := CurrentEntry^.PrevEntry;
  194.       End;
  195.       Row := Row - (Counter - 1);
  196.       DisplayScreen;
  197.     End;
  198.   End;
  199. {========================================================================}
  200. Procedure PageDown;
  201.   Begin
  202.     If NumberOfEntries <= 23 Then
  203.     Begin
  204.       CurrentEntry := LastEntry; Row := NumberOfEntries;
  205.       DisplayScreen;
  206.     End
  207.     Else
  208.     Begin
  209.       Counter := 1;
  210.       While (Counter < 23) And (TopEntry^.NextEntry <> NIL) Do
  211.       Begin
  212.         Inc(Counter); TopEntry := TopEntry^.NextEntry;
  213.       End;
  214.       While (Counter > 1) And (CurrentEntry^.NextEntry <> NIL) Do
  215.       Begin
  216.         Dec(Counter); CurrentEntry := CurrentEntry^.NextEntry;
  217.       End;
  218.       Row := Row - (Counter - 1);
  219.       DisplayScreen;
  220.     End;
  221.   End;
  222. {========================================================================}
  223. Procedure TopOfList;
  224.   Begin
  225.     CurrentEntry := FirstEntry; TopEntry := FirstEntry; Row := 1;
  226.     DisplayScreen;
  227.   End;
  228. {========================================================================}
  229. Procedure BottomOfList;
  230.   Begin
  231.     If NumberOfEntries <= 23 Then
  232.     Begin
  233.       CurrentEntry := LastEntry;
  234.       Row := NumberOfEntries;
  235.       DisplayScreen;
  236.     End
  237.     Else
  238.     Begin
  239.       CurrentEntry := LastEntry; TopEntry := LastEntry;
  240.       Row := 23;
  241.       Repeat
  242.         TopEntry := TopEntry^.PrevEntry;
  243.         Dec(Row);
  244.       Until Row = 1;
  245.       Row := 23;
  246.       DisplayScreen;
  247.     End;
  248.   End;
  249. {========================================================================}
  250.